//给标志位通过和未通过赋便未选择ﺿ 通过: 1 不通过:2 
function trClick(i,name,uname){
		var varName = document.getElementsByName(name)[i].checked;
		var varUname = document.getElementsByName(uname)[i].checked;
		if(name == "DIS_CREDITNO" && varName == true ){//未通过触发，并且选中
			document.getElementById("mes_r"+i).style.display="block";
			document.getElementsByName(uname)[i].checked = false;
		}
		if(name == "DIS_CREDITNO" && varName == false ){//未通过触发，未选中
			document.getElementById("mes_r"+i).style.display="none";
		}
		if(name == "CREDITNO" && varName == true ){//通过触发，并且选中
			document.getElementById("mes_r"+i).style.display="none";
			document.getElementsByName(uname)[i].checked = false;
		}
		onCheck(name,uname);
}

function onCheck(name,uname){
    var a=document.getElementsByName(name);
    var ua=document.getElementsByName(uname);
    a[a.length - 1].checked = isAllChecked(name);
    ua[ua.length - 1].checked = false;
}

function tClick(elementSrc){
	if(elementSrc.tagName.toUpperCase()=='TR'){
		
		elementSrc.getElementsByTagName('INPUT')[0].checked=!elementSrc.getElementsByTagName('INPUT')[0].checked;
		if(elementSrc.getElementsByTagName('INPUT')[0].type=="checkbox"){
		isSelectedAllV6(elementSrc.getElementsByTagName('INPUT')[0].name);
		}
		
	}else{
		
	 if(event.stopPropagation){
       event.stopPropagation();
    }else{
        event.cancelBubble=true;
  }
	 if(elementSrc.type=="checkbox"){
	isSelectedAllV6(elementSrc.name);
	}
	}
}




function isAllChecked(flag){
   var a=document.getElementsByName(flag);
   for(var i=0;i<a.length-1;i++){
       if(a[i].checked==false){
          return false;
       }
   }
  return true;
}

//全选
function AllSelect(nameSelected,nameUnselected){
	var allName = document.getElementsByName(nameSelected);
	if(nameUnselected != null && nameUnselected != ""){
		var uallName = document.getElementsByName(nameUnselected);
		for(var i=0;i<uallName.length;i++){
			uallName[i].checked = false;
		}
	}
	if(allName[allName.length-1].checked == true){
		for(var i=0;i<allName.length -1;i++){
			allName[i].checked = true;
		}
	}
	if(allName[allName.length-1].checked == false){
		for(var i=0;i<allName.length -1;i++){
			allName[i].checked = false;
		}
	}
	if(nameSelected == "DIS_CREDITNO" && allName[allName.length-1].checked == true){
		for(var i=0;i<allName.length-1;i++){
				document.getElementById("mes_r"+i).style.display="block";
			}
	}
	else{
		if(nameUnselected != null && nameUnselected != ""){
			for(var i=0;i<allName.length-1;i++){
				document.getElementById("mes_r"+i).style.display="none";
			}
		}
	}
}

//多选检测是否未选中记录
function isHasSelected(){
	var a=document.getElementsByName("CREDITNO");
	var c=document.getElementsByName("DIS_CREDITNO");
    for(var i=0;i<a.length-1;i++){
       if(a[i].checked==true || c[i].checked==true){
      	 return true;
       }
   	}
   return false;
}

//单选检测是否未选中记录
function HasSelected(){
	var a=document.getElementsByName("CREDITNO");
    for(var i=0;i<a.length;i++){
       if(a[i].checked==true){
      	 return true;
       }
   	}
   return false;
}
//获取loop隐藏表单便授权通过和不通过两种
function getInputAreaForloop(){
	var varName = document.getElementsByName("CREDITNO");
	var disVarName = document.getElementsByName("DIS_CREDITNO");
	for(var i=0;i<varName.length-1;i++){
       if(varName[i].checked==true){//通过第i个选中，赋值为1
      		document.getElementById('condition_flag_'+i).value="1";
       }
       if(disVarName[i].checked==true){//未通过第i个选中，赋值为2
      		document.getElementById('condition_flag_'+i).value="2";
       }
       if(varName[i].checked==false && disVarName[i].checked==false){//否则为未选中，清单隐藏域
       		document.getElementById('InputDIV_'+i).innerHTML="";
       }
   	}
}

//维护列表取便
function getInputAreaForloopSingle(){
	var varName = document.getElementsByName("CREDITNO");
	for(var i=0;i<varName.length-1;i++){
       if(varName[i].checked==false){//否则为未选中，清单隐藏域
       		document.getElementById('InputDIV_'+i).innerHTML="";
       }
   	}
}
//长度检查是否越铿v是this变量，l是长度限冿
 function checkLength(v,l){
		var s= v.value;
		if(s.length  > l){
			return false;
		}
		return true;
}

//特殊字符检泿
function isSpecialChar( s ){
	var isIntCharSpecials = RegExp(/^[a-zA-Z0-9\u4e00-\u9fa5(\?)(\&)(\,)(\;)(\.)(\-)(\+)(\=)(\#)(\@)(\/)(\()(\))(\s)(\n)(\r)]+$/);
	return ( isIntCharSpecials.test(s) );
 }

//中文检泿
function isChinese(s){
	 var isIntCharSpecials = RegExp(/^[\u4e00-\u9fa5]+$/);
	return ( isIntCharSpecials.test(s) );
 }
 
//是否是数嫿
function isNum(v){ 
	if(!isNaN(v.value)) { 
		return true;
	} 
	return false;
}

//批量选择复核叿
function batchSelected(selectName,selectValue){
	var selects = document.getElementsByName(selectName);
	if(selects.length > 0){
		for(var i=0; i<selects.length;i++){
				var options = selects[i].options;
				for(var j=0;j<options.length;j++){
					var optionValue=options[j].value;
					if(optionValue ==selectValue){
						options[j].selected=true;
					}
				}
		}
	}
}

//单个全选

function trClickSingle(varName){
	var varNameList = document.getElementsByName(varName);
	if(isAllChecked('CREDITNO')){
		varNameList[varNameList.length-1].checked = true;
	}
	else{
		varNameList[varNameList.length-1].checked = false;
	}
}

/****************
*以下方法命名为xxxV6是上面所有方法的优化，主要是接收动态传参⾿
*
*上面的方法有太多要求固定变量
*
****/


/*给标志位通过和未通过赋便未选择ﺿ 通过: 1 不通过:2 (mes_r为不通过原因ID前缀)
*参数说明ﺿ
*i:行号
*name:通过复选名称
*uname:不通过复选名称
*nameCheck:检测name变量，与变量name值保持一致
*unameCheck:检测uname变量，与变量uname值保持一致
********/
function checkBoxClickV6(i,name,uname,nameCheck,unameCheck){
		var varName = document.getElementsByName(name)[i].checked;
		var varUname = document.getElementsByName(uname)[i].checked;
		if(name == unameCheck && varName == true ){//未通过触发，并且选中
			document.getElementById("mes_r"+i).style.display="block";
			document.getElementsByName(uname)[i].checked = false;
		}
		if(name == unameCheck && varName == false ){//未通过触发，未选中
			document.getElementById("mes_r"+i).style.display="none";
		}
		if(name == nameCheck && varName == true ){//通过触发，并且选中
			document.getElementById("mes_r"+i).style.display="none";
			document.getElementsByName(uname)[i].checked = false;
		}
		onCheckV6(name,uname);
}

function onCheckV6(name,uname){
    var a=document.getElementsByName(name);
    var ua=document.getElementsByName(uname);
    a[a.length - 1].checked = isAllCheckedV6(name);
    ua[ua.length - 1].checked = false;
}

function trCheckboxClick(i,name){
		var a=document.getElementsByName(name);
            a[i].checked=!a[i].checked;
			isSelectedAllV6(name);
}

function isAllCheckedV6(flag){
   var a=document.getElementsByName(flag);
   for(var i=0;i<a.length-1;i++){
       if(a[i].checked==false){
          return false;
       }
   }
  return true;
}


//单选框单击
function radioClickV6(i,name){
	var a=document.getElementsByName(name);
    	a[i].checked=!a[i].checked;
}


/**
 * 行单击选择
 * @param {Object} obj this当前行
 */
function trSinClick(obj){//
  //  var checkbox = obj.firstChild.firstChild;//当前行的checkbox
	  var checkbox = obj.children[0].children[0];
	
    var result = !checkbox.checked;
    checkbox.checked = result;
    if(result==true){//设置传值
	 obj.children[0].children[1].disabled="";
	 }else{
	   checkbox.nextSibling.nextSibling.disabled="disabled";
	 }
	 if(obj.children[0].children[0].type=="checkbox"){
		 isSelectedAllV6(checkbox.name);
		}
   }


function checkboxClick(obj,event){//复选框单击
	/*
	var result = obj.checked;
 
     if(result==true){//设置传值

    obj.nextSibling.nextSibling.disabled="";
	 }else{
	   obj.nextSibling.nextSibling.disabled="disabled";
  } 
	*/
   if(event.stopPropagation){
  event.stopPropagation();
  }else{
  event.cancelBubble=true;
  }

  if(obj.type=="checkbox"){
	isSelectedAllV6(obj.name);
	}
}
//全选,全不选
function sinAllSelect(name){
     
	var allName = document.getElementsByName(name);
    
	if(allName[allName.length-1].checked == true){
		for(var i=0;i<allName.length -1;i++){
			allName[i].checked = true;
			allName[i].nextSibling.nextSibling.disabled="";
		}
	}
	if(allName[allName.length-1].checked == false){
		for(var i=0;i<allName.length -1;i++){
			allName[i].checked = false;
			allName[i].nextSibling.nextSibling.disabled="disabled";
		}
	}
}






/*全选实现：有通过和不通过复选，实现全选功能
*参数说明ﺿ
*nameSelected:通过复选名称
*nameUnselected:不通过复选名称
*unSelectCheckedName:检测uname变量，与变量nameUnselected值保持一致
********/
function bothAuthAllSelectV6(nameSelected,nameUnselected,unSelectCheckedName){
	var allName = document.getElementsByName(nameSelected);
	if(nameUnselected != null && nameUnselected != ""){
		var uallName = document.getElementsByName(nameUnselected);
		for(var i=0;i<uallName.length;i++){
			uallName[i].checked = false;
		}
	}
	if(allName[allName.length-1].checked == true){
		for(var i=0;i<allName.length -1;i++){
			allName[i].checked = true;
		}
	}
	if(allName[allName.length-1].checked == false){
		for(var i=0;i<allName.length -1;i++){
			allName[i].checked = false;
		}
	}
	if(nameSelected == unSelectCheckedName && allName[allName.length-1].checked == true){
		for(var i=0;i<allName.length-1;i++){
				document.getElementById("mes_r"+i).style.display="block";
			}
	}
	else{
		if(nameUnselected != null && nameUnselected != ""){
			for(var i=0;i<allName.length-1;i++){
				document.getElementById("mes_r"+i).style.display="none";
			}
		}
	}
}
   //

//当所复选框选中时，全选这个复选框也要选中

function isSelectedAllV6(varName){
	var varNameList = document.getElementsByName(varName);
	if(isAllChecked(varName)){
		varNameList[varNameList.length-1].checked = true;
	}
	else{
		varNameList[varNameList.length-1].checked = false;
	}
}

/*通过与不通过，检测是否未选中记录⾿
*
*name:通过复选框县
*uname:不通过复选框县
*
**/
function isHasSelectedBothAuthV6(name,uname){
	var a=document.getElementsByName(name);
	var c=document.getElementsByName(uname);
    for(var i=0;i<a.length-1;i++){
       if(a[i].checked==true || c[i].checked==true){
      	 return true;
       }
   	}
   return false;
}

//单选及单个复选框检测是否未选中记录
function HasSelectedV6(name){
	var a=document.getElementsByName(name);
    for(var i=0;i<a.length;i++){
       if(a[i].checked==true){
      	 return true;
       }
   	}
   return false;
}


/*获取loop隐藏表单便授权通过和不通过两种
*其中condition_flag_和INPUTDIV必须固定
*name:通过复选框县
*uname:不通过复选框县
*
**/
function getInputAreaLoopBothauthV6(name,uname){
	var varName = document.getElementsByName(name);
	var disVarName = document.getElementsByName(uname);
	for(var i=0;i<varName.length-1;i++){
       if(varName[i].checked==true){//通过第i个选中，赋值为1
      		document.getElementById('condition_flag_'+i).value="1";
       }
       if(disVarName[i].checked==true){//未通过第i个选中，赋值为2
      		document.getElementById('condition_flag_'+i).value="2";
       }
       if(varName[i].checked==false && disVarName[i].checked==false){//否则为未选中，清单隐藏域
       		document.getElementById('InputDIV_'+i).innerHTML="";
       		document.getElementsByName("ADUIT_FAIL_STAT")[i].disabled="true";
       }
   	}
}


/*获取loop隐藏表单便仅有一个复选框，如批量删除敿
*其中condition_flag_和INPUTDIV必须固定
*name:通过复选框县
*uname:不通过复选框县
*
**/
function getInputAreaLoopV6(name){
	var varName = document.getElementsByName(name);
	for(var i=0;i<varName.length-1;i++){
       if(varName[i].checked==false){//否则为未选中，清单隐藏域
		varName[i].parentNode.parentNode.getElementsByTagName('div')[0].innerHTML="";
       }
       if(varName[i].checked==true){//选中，可璿
    	  
       }
   	}
}


/*批量选择复核叿
*
*selectName:批量选择复核员下拉框名称
*selectValue:批量选择复核员下拉框便
*
**/
function batchSelectedOperV6(selectName,selectValue){
	var selects = document.getElementsByName(selectName);
	if(selects.length > 0){
		for(var i=0; i<selects.length;i++){
				var options = selects[i].options;
				for(var j=0;j<options.length;j++){
					var optionValue=options[j].value;
					if(optionValue ==selectValue){
						options[j].selected=true;
					}
				}
		}
	}
}


/******************************
*日期相关方法------开始
*************/
function changeDateFormatV6(dmy){
	//YYYY-MM-DD -> YYYYMMDD
	return (dmy.substr(0, 4) + dmy.substr(5, 2) + dmy.substr(8,2));
 }
 
function formatDateV6(dmy){
	//YYYYMMDD -> YYYY-MM-DD
	document.write( (dmy.substr(0, 4) +"-"+ dmy.substr(4, 2)+"-" + dmy.substr(6,2)));
 }
 
//日期范围以及格式检验
 function CompareDate1V6(beginDate,bdName,endDate,edName){
	var bdValue = jhform.elements[beginDate].value
	var edValue = jhform.elements[endDate].value
	if(bdValue!=''){
	if(!CheckDateV6(beginDate,bdName)){
		return false
	}
	}
	if(edValue!=''){
	if (!CheckDateV6(endDate,edName)){
		return false
	}
	}
	if(edValue!=''&&bdValue!=''){
	 if (bdValue > edValue){
		alert(bdName + "不能大于" + edName)
		jhform.elements[beginDate].focus()
		return false
	}
	 }
	
		return true
	
}
 
 
function CheckDateV6(Number1,name,State,regExpe) {
	var inputValue = jhform.elements[Number1].value
	var inputForm  = jhform.elements[Number1]
	if(State==1){
		if(isEmpty(inputValue)){
			alert(name + "不能为空!")
			inputForm.focus()
			return false
		}
	}
	var regExpe = /^\d{8}$/;
	var aryStr = inputValue.match(regExpe);
   	if(aryStr==null){
  		alert(name + "日期格式不正确! \n 标准日期格式:YYYYMMDD");
    	inputForm.focus()
    	return false;
  	}
	if (!isCorrectDateV6(inputValue)){
		alert(name + "日期格式不正确! \n 标准日期格式:YYYYMMDD");
		inputForm.focus()
		return false
	}
	else{
		return true
	}
}
function isCorrectDateV6(Number1){
	if (Number1.length != 8) {
		return false
	}
	var Number2  = Number1;
	for(var i = 0;i < 8;i++){
		var oneChar = Number2.charAt(i)
		if(oneChar < "0" || oneChar > "9"){
			return false
		}
	}
	if (!isDate(Number2)){
		return false
	}else{
		return true
	}
}

function CompareDate2V6(beginDate,bdName,endDate,edName){
	var bdValue = jhform.elements[beginDate].value
	var edValue = jhform.elements[endDate].value
	if(!CheckDateV6(beginDate,bdName)){
		return false
	}
	else if (!CheckDateV6(endDate,edName)){
		return false
	}
	else if (changeDateFormatV6(bdValue) >= changeDateFormatV6(edValue))
	{
		alert(edName + "不能小于或等于" + bdName)
		jhform.elements[beginDate].focus()
		return false
	}
	else {
		return true
	}
}
 

 function CompareDateV6(beginDate,bdName,endDate,edName,State){
	if (State != "1" && State != "2"){
		alert("最后一个参数只能为1或者2!")
		return false
	}
	if(State == "1" && !CompareDate1V6(beginDate,bdName,endDate,edName)){
		return false
	}
	else if (State == "2" && !CompareDate2V6(beginDate,bdName,endDate,edName)){
		return false
	}
	else {
		return true
	}
}

/******************************
*日期相关方法-----结束
*************/




/******************************
*金额相关方法-----开始
*************/

 function moneyCompare(starMoney,endMoney){
	var starMeoy = getoff_Qfw(document.getElementById(starMoney).value);
	var endMeoy = getoff_Qfw(document.getElementById(endMoney).value);
	var intStarMeoy = parseFloat(starMeoy);
	var intEndMeoy = parseFloat(endMeoy);
	if(intStarMeoy>intEndMeoy){
		alert("金额下限大于金额上限,请重新输入!");
			return false;
	}else{
			return true;
	}
}
 

 
////////////////根据金额小写输入，动态输出大写金额///////////////////////////
var strLast="";//上次输入的字符串
var strWithQfw;//原始字符串
var strWithoutQfw;//去掉千分位的字符串
var intLen=0;//整数部分长度
 
function isDigit(str){
// Modified by Wayne Zheng 2010-06-02
//	var s = /\d+.\d[0-2]/g;
 
	var s = /^[\d,]+(\.\d{0,2})?$/;
	return s.test(str);
}
function getmyselfDate(a){
	if (a<10)
	{
		return "0"+a;
	}
	return a;
}
 
//去掉 ","
function getoff_Qfw(cash){
    var len=cash.length;
    var ch="";
    var newCash="";
    for (var ii=0;ii<len;ii++){
        ch=cash.charAt(ii);
        if (ch!=","){newCash=newCash+ch;
        }
    }
    return newCash;
}
 
 
//加上","
function add_Qfw(cash)
{
    var len=cash.length;
    var cashNew="";//加上","的字符串
    var tt=0;//计数器，每加一个"," tt 加 1 
    var t=0;//添加","的个数
    if(intLen>3)
    	{
    		t=(intLen-intLen%3)/3;
    	}
    else
    	return cash;
    
    //个数部分长度不是3的倍数
    if(intLen%3 !=0)
    {
	    for (var ii=0;ii<len;ii++)
	    {
	       cashNew=cashNew+cash.charAt(ii);
		       if (ii== (intLen%3+3*tt-1) &&  tt<t)
		       {
		        tt=tt+1;
		       	cashNew=cashNew+",";
		       }
	    }
	}
	//个数部分长度是3的倍数
	else
	{
		tt=tt+1;
	    for (var ii=0;ii<len;ii++)
	    {
	       cashNew=cashNew+cash.charAt(ii);
		       if (ii== (3*tt-1) &&  tt<t)
		       {
		        tt=tt+1;
		       	cashNew=cashNew+",";
		       }
	    }	
	
	}
	if(cashNew.charAt(0)=="-"){
		if(cashNew.charAt(1)==","){
			var pp;
			pp=cashNew.length;
			var uu = cashNew.substring(2,pp);
			return "-"+uu;
		}else{
			return cashNew;
		}
	}else{
		return cashNew;
	}
}
 
 
/*****************************************/
//判断数值,是否为浮点数
function MycheckFloat(str) { 
	var length1 , i , j;
	var string1="";
   
    /* Added by cxl on 20061009*/
    var ofstr=getoff_Qfw(str);
    var oflen=ofstr.length;
    if(oflen>0 && ofstr.charAt(oflen-1)==" ") return(false);
    /* Added end */
    
    str = javaTrim(str);
    string1=str;
	length1 = string1.length;
	if (length1 == 0) 
	{
		alert( "错误！空串！");
		return(false); 
	}
	if(str == "js6/tx/0.00")
	{
	    //alert("金额不能为0，请重新填写！");
	    return(false);
	}
 
   if(str.charAt(0)=="0" )
   {
        /* Added by cxl */
        if(length1 > 1){
	    var num=0;
	    for(var i = 0; i < oflen; i++){
                var c = ofstr.charAt(i);
                if(c==0) num++;
            }
            if(num==oflen || (num==oflen-1 && ofstr.charAt(oflen-3)==".")){
                alert("金额不能为0，请重新填写！");
                return(false);
            }
        }
        /* Added end */
            
      	if(length1 == 4 && str == "js6/tx/0.00")
      	{
            alert("金额不能为0，请重新填写！");
	    return(false);
        }
      	/*else
      	{
      	    if(!(str.charAt(1)=="."))
      	    {
		alert("金额首位不能为0，请重新填写！");
		return(false);
	    }
	}*/
    }
    
    if(str.charAt(0)==".")
    return false;
	j=0;
	
	if(str.charAt(0)=="-") {
		for (i = 1 ; i < length1 ; i++) {  //判断每位数字
		if(isNaN(parseInt(str.charAt(i),10)))  {
			if(str.charAt(i) != ".")  {
				//alert( "错误！请输入数值型数据！");					
				return(false); 
			} else  {j++;
			if(length1 - i > 3 ){
			//alert("小数点后只能有两位！");
			 return(false);}
			  }
 		}		
	}
	}else{
		for (i = 0 ; i < length1 ; i++) {  //判断每位数字
		if(isNaN(parseInt(str.charAt(i),10)))  {
			if(str.charAt(i) != ".")  {
				//alert( "错误！请输入数值型数据！");					
				return(false); 
			} else  {j++;
			if(length1 - i > 3 ){
			//alert("小数点后只能有两位！");
			 return(false);}
			  }
 			}		
		}
	}
	if(j > 1) {
		//alert( "错误！小数点只能有一个!");			
		return(false);
	}
	return (true);
}
 
/**
  * 对金额添加前分位分割
  * Added by Wayne Zheng 2010-06-03
  */
function changeAmount(textAmount)
{
	amountWithComma=textAmount.value;
    //alert(amountWithComma);
	if(amountWithComma=="")
	{
		textAmount.value=""; 
		strLast="";
	}
	else
	{	
 
		//去掉千分位
		strWithoutQfw=getoff_Qfw(amountWithComma);
		//alert("strWithoutQfw:"+strWithoutQfw);
			
		if(!MycheckFloat(strWithoutQfw)){
			textAmount.value=strLast;
			textAmount.focus();
			return false;
		}
		
	    var dot=strWithoutQfw.indexOf(".");
	    if (dot<0)
	    	dot=strWithoutQfw.length;
	    intLen=(strWithoutQfw.substring(0,dot)).length;
		
		
		
	    
	    //添加千分位，重新显示在小写输入框中
    	amountWithComma = add_Qfw(strWithoutQfw);
    	textAmount.value=amountWithComma; 
    	strLast=amountWithComma;
 
    }
}
 
 
/**
	* 格式化金额,精确到小数点后2位
	* Added by Wayne Zheng 2010-06-03
	*/
function formatAmount(textAmount) {
		 
	var tradeMoney = textAmount.value;
	if(tradeMoney.indexOf(".")!=-1) {
		 
		var i=tradeMoney.indexOf(".");
		tradeMoney=tradeMoney+"00";
		textAmount.value=tradeMoney.substring(0,i+3);
	}
	else { 
		if(textAmount.value!="") {
		textAmount.value=tradeMoney+".00";
		}
	}
	if(textAmount.value==0.00) {	 
 
		return false;
	}
 
	 
	return true;
}

 //最小金额最大金额验证
 function checkMoney(MIN_AMT,MAX_AMT){
     if(document.getElementById(MIN_AMT).value!="" && !isDigit(document.getElementById(MIN_AMT).value))
	{
		alert("金额下限必须为数字！");
		document.getElementById(MIN_AMT).value="";
		document.getElementById(MIN_AMT).focus();
		return false;
	}
 
	if(document.getElementById(MAX_AMT).value!="" && !isDigit(document.getElementById(MAX_AMT).value))
	{
		alert("金额上限必须为数字！");
		document.getElementById(MAX_AMT).value="";
		document.getElementById(MAX_AMT).focus();
		return false;
	}
	if(document.getElementById(MIN_AMT).value!=""&&document.getElementById(MAX_AMT).value!=""){
		if(!moneyCompare(MIN_AMT,MAX_AMT)){
			return false;
		}
	}
 
	document.getElementById(MIN_AMT).value = document.getElementById(MIN_AMT).value.replace(/,/g,'');
	document.getElementById(MAX_AMT).value = document.getElementById(MAX_AMT).value.replace(/,/g,'');
	return true;
}

/******************************
*金额相关方法-----结束
*************/


/******************************
*排序开始-----
*************/
  function sortTableV6(tableId,sortCol,compareType){
 	 try{
  		  var table = document.getElementById(tableId);
 		  var objRows = table.getElementsByTagName("tr");
  		  var endRows = objRows.length;
   	      if (endRows < 4) //only one line,don't sort
   		  return ;
  		  var cols = objRows[1].getElementsByTagName("td").length;
  		  sortTableInRange(tableId,sortCol,compareType,2,endRows-1,1,cols);
  		}catch(e){
   		alert(e);
  	}
}
 
 
 /******************************
*排序结束-----
*************/



 /*********
 获取Radio值
 *********/
function getRadioValue(radioName){	
	var radioList = document.getElementsByName(radioName);
	for (var i = 0; i < radioList.length; i++){
		if( radioList[i].checked == true ){
			return radioList[i].value;
		}
	}
}

/***************
JS算法解决精度问题

*****************/

//加法，若做减法参数arg2为-arg2,flag参数为+-*/
function mathJS(arg1,arg2,flag){
	var arg1Str = arg1.toString();
	var arg2Str = arg2.toString();
	var num1=0;
	var num2=0;
	var result;
	var result1;
	if(flag=="-"){
		try{num1 = arg1Str.split(".")[1].length;}
		catch(e){num1 =0;}
		try{num2 = arg2Str.split(".")[1].length;}
		catch(e){num2 =0;}
		result = Math.pow(10,Math.max(num1,num2));
		return (arg1*result-arg2*result)/result;
		
	}
	if(flag=="+"){
		try{num1 = arg1Str.split(".")[1].length;}
		catch(e){num1 =0;}
		try{num2 = arg2Str.split(".")[1].length;}
		catch(e){num2 =0;}
		result = Math.pow(10,Math.max(num1,num2));
		return (arg1*result+arg2*result)/result;
	}
	if(flag == "*"){
		try{num1 += arg1Str.split(".")[1].length;}
		catch(e){}
		try{num1 += arg2Str.split(".")[1].length;}
		catch(e){}
		return Number(arg1Str.replace(".",""))*Number(arg2Str.replace(".",""))/Math.pow(10,num1);
	}
	if(flag == "/"){
		try{num1 = arg1Str.split(".")[1].length;}
		catch(e){}
		try{num2 = arg2Str.split(".")[1].length;}
		catch(e){}
		with(Math){
		result = Number(arg1Str.replace(".",""));
		result1 = Number(arg2Str.replace(".",""));
		return (result/result1)*pow(10,num2-num1);
		}
	}
}

//**************去掉字符串前后的空格************
function javaTrim(string){
	var length1, i, j;
	var string1 = "";
	
	length1 = string.length;
	for (i = 0 ; i < length1 ; i++)	{
		if(string.charAt(i) != " ")	{
			for (j = i ; j < length1 ; j++) 
				string1 = string1 + string.charAt(j);
				break;
		}
	}	
	length1 = string1.length;
	string = string1;
	string1 = "";
	for (i = length1 - 1 ; i >= 0 ; i--) {
		if(string.charAt(i) != " ") {
			for (j = 0 ; j <= i ; j++) 
				string1 = string1 + string.charAt(j);
				break;	
		}
	}
	string = string1;	
	return(string)	
}






